require(['config'], function () {
    require(['jquery'], function () {
        const username = $('.inputtext');
        const password = $('.inputpass');
        const form = $('.form-wrap');
        const btn = $('.login .log-btn')
        console.log(btn);
        let phpurl = 'http://10.31.155.19/MallProject/php/';
        btn.click(function () {
            $.ajax({
                type: 'POST',
                url: phpurl + 'login.php',
                // datatype: 'json',
                data: { username: username.val(), password: password.val() }
            }).done(function (logindata) {
                console.log(logindata);
                console.log(logindata);
                if (logindata) {
                    alert('登陆成功');
                    location.href = 'index.html';
                    localStorage.setItem('name', username.value);
                } else {
                    alert('用户名或者密码错误');
                }
            });
        });

    });
});